Skip to content

fix(parquet/compress): avoid closing caller streams for uncompressed wrappers - #1003

Merged
zeroshade merged 1 commit into
apache:mainfrom
fallintoplace:fix/parquet-uncompressed-stream-close
Jul 27, 2026
Merged

fix(parquet/compress): avoid closing caller streams for uncompressed wrappers#1003
zeroshade merged 1 commit into
apache:mainfrom
fallintoplace:fix/parquet-uncompressed-stream-close

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

The compressed streaming codecs close their own wrappers without taking ownership of the caller stream. The uncompressed codec passed through existing closers directly, so closing the wrapper also closed the underlying reader or writer.

This always wraps uncompressed streams in no-op closers and adds regression tests for both read and write wrappers.

Tests: go test ./parquet/compress

@fallintoplace
fallintoplace requested a review from zeroshade as a code owner July 24, 2026 23:32
@fallintoplace fallintoplace changed the title fix(parquet/compress): preserve uncompressed stream ownership fix(parquet/compress): wrap uncompressed streams with no-op closers Jul 25, 2026
@fallintoplace fallintoplace changed the title fix(parquet/compress): wrap uncompressed streams with no-op closers fix(parquet/compress): keep uncompressed wrappers from closing caller streams Jul 25, 2026
@fallintoplace fallintoplace changed the title fix(parquet/compress): keep uncompressed wrappers from closing caller streams fix(parquet/compress): avoid closing caller streams for uncompressed wrappers Jul 25, 2026

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against current main: nocodec.NewReader/NewWriter return the caller's stream directly when it already implements io.ReadCloser/io.WriteCloser, so calling Close() on the returned wrapper closes the caller's underlying stream. That is inconsistent with every other codec — gzip's Close does not touch the underlying stream, and snappy/brotli/zstd all wrap via io.NopCloser. The established contract for StreamingCodec is clearly that the codec does not take ownership of the caller's stream, so always wrapping in a no-op closer is the correct fix.

I confirmed no internal caller depends on the old close-through behavior. The tests are meaningful — they assert the underlying closeTrackingBuffer stays open after closing the wrapper. LGTM.

@zeroshade
zeroshade merged commit edc4921 into apache:main Jul 27, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants